@echo off

set RETURN=end

set JSBUILDER=.\tool\bin\JSBuilder2.jar
set DEPLOY_DIR=.\build\
set FRAMEWORK_COMPILED=0
set APPLICATION_COMPILED=0
goto:%~1
    
:all
    SET RETURN=all
    IF %FRAMEWORK_COMPILED%==0 goto:framework
    IF %APPLICATION_COMPILED%==0 goto:application
    GOTO:end

:framework
    java -jar %JSBUILDER% -p .\ext.jsb2 -d %DEPLOY_DIR% -v
    set FRAMEWORK_COMPILED=1
    goto:%RETURN%

:application
    java -jar %JSBUILDER% -p .\oms.jsb2 -d %DEPLOY_DIR% -v
    java -jar %JSBUILDER% -p .\air.jsb2 -d %DEPLOY_DIR% -v
    set APPLICATION_COMPILED=1
    goto:%RETURN%


:package
    :: Path to Flex SDK binaries
    set AIRSDK=D:\ezhuravlev\AdobeAIRSDK\bin
    set PATH=%PATH%;%AIRSDK%

:end